package godis

type InterfaceResult struct {
	Result interface{}
	Err    error
}

func NewInterfaceResult(result interface{}, err error) *InterfaceResult {
	return &InterfaceResult{
		Result: result,
		Err:    err,
	}
}
func (self *InterfaceResult) UnWarp() interface{} {

	if self.Err != nil {
		panic(self.Err)
	}
	return self.Result
}

func (self *InterfaceResult) UnWarpOr(expr interface{}) interface{} {

	if self.Result == nil {
		return expr
	}
	return self.Result
}
